package top.ninwoo.utils.service;

import top.ninwoo.utils.entity.ChainEntity;
import top.ninwoo.utils.entity.ChainType;

import java.util.List;
import java.util.Map;

/**
 * @Author joliu
 * @Description iptables的服务接口
 * @Date　Create in 上午10:07 2019/10/30
 */
public interface IptablesService {

    Map<String, List<ChainEntity>> getIptablesByContainerId(String containerId);

    List<ChainEntity> getIptablesByContainerId(String containerId, ChainType chainType);

    List<ChainEntity> getIptablesByContainerId(String containerId, ChainType chainType, String type);

    ChainEntity getIptablesByContainerId(String containerId, ChainType chainType, int lineNumber);

    void checkCache(String containerId);

    void deleteIptable(String containerId, ChainEntity chainEntity);

    void deleteIptablesFromList(String containerId, ChainEntity chainEntity);

    void deleteIptableById(String containerId, ChainType type, int lineNumber);

    boolean forwardTraffic(String containerId, String selfIp, int selfPort, String toIp, int toPort);

    void dropTraffic(String containerId, String sourceIp, String destinationIp);

    void cancelDropTraffic(String containerId, String souceIp, String destinationIp);
}
